import request from '@/utils/requestHall';

export function treeMenu(query) {
  return request({
    // url: '/api/system/menu/treeMenu',
    url: `/menu/list${query}`,
    method: 'get'
  })
}

export function saveMenu(form) {
  return request({
    url: '/menu/add',
    method: 'post',
    data: form
  })
}

export function updateMenu(form) {
  return request({
    url: '/menu/update',
    method: 'post',
    data: form
  })
}

export function cacheMenu() {
  return request({
    url: '/menu/cache',
    method: 'get',
  })
}

export function deleteMenu(id) {
  return request({
    url: '/api/system/menu/delete',
    method: 'post',
    data: {'id': id}
  });
}

// ========================== 上面是用到的

export function getSysPermissionPage(query) {
  return request({
    url: '/api/system/menu/listPage',
    method: 'post',
    data: query
  });
}

export function getSysPermissionById(id) {
  return request({
    url: '/api/system/menu/getById',
    method: 'post',
    data: {'id': id}
  });
}
